<?php
use app\common\model\Category;
?>
{layout name="layout/layout" /}
{:widget('Menu/index',['category_id'=>$category_id])}
<div class="king-content-wrap">
    <div class="king-layout1-content" style="margin-top: 0;">
		<ol class="breadcrumb">
			<li><span>内容管理</span></li>
			<li><span><?php echo Category::get($category_id)['title']; ?></span></li>
	    </ol>
		<div class="panel panel-default m20">
			<div class="panel-body">
				<form action="{:Url('Article/edit')}" method="post" id="form" >
					<div class="label_list top20">
						<label class="label_name">标题<span style="color: red;font-size: 13px;">（还可输入<span id="show1">10</span>个字）</span></label>
						<input type="text" oninput="ee()" id="title"  class="form-control" name="title" value="{$item.title??''}"/>
					</div>
					<div class="label_list top20">
						<label class="label_name">封面图<span style="color: red;font-size: 13px;">(图片大小:536x274)</span></label>
						<div class="label_img ">
							{:widget('Upload/image',['src' => $item.src??''])}
						</div>
					</div>
					<div class="label_list top20">
						<label class="label_name">简介<span style="color: red;font-size: 13px;">（最多<span id="show">40</span>个字）</span></label>
						<input oninput="ss()" onsubmit="return mySubmit();" id="jianjie" type="text" class="form-control" name="description"  value="{$item.description??''}" />
					</div>
					<div class="label_list top20">
						<label class="label_name">链接</label>
						<input type="text" class="form-control" name="url"  value="{$item.url??''}" />
					</div>
					<div class="label_list top20">
						<label class="label_name">是否跳转</label>
						<input type="radio" name="isskip" value="1" <?php if($item['isskip'] == '1'){echo 'checked';}?>/>是
						<input type="radio" name="isskip" value="0" <?php if($item['isskip'] == '0'){echo 'checked';}?>/>否

					</div>
					<div class="label_list top20">
						<label class="label_name">内容</label>
						<textarea name="content" id="ueditor" class="word_editor">{$item.content??''}</textarea>
					</div>
					<hr />
					<div class="label_list top20">
						<label class="label_name">seo_title</label>
						<input class="form-control"  type="text" name="seo_title" value="{$item.seo_title??''}" />
					</div>
					<div class="label_list top20">
						<label class="label_name">seo_keyword</label>
						<input class="form-control"  type="text" name="seo_keyword" value="{$item.seo_keyword??''}" />
					</div>
					<div class="label_list top20">
						<label class="label_name">seo_description</label>
						<input class="form-control"  type="text" name="seo_description" value="{$item.seo_description??''}" />
					</div>
					<div class="form-group">
						<input type="submit" class="bos_button btn btn-success" value="保存" />
					</div>
					<input type="hidden" name="id" value="{$item.id}" />
				</form>
			</div>
		</div>
	</div>
</div>
<script>

	function mySubmit(flag){
		return flag;
	}
	$("#form").submit(function(){
		var tel = $('#jianjie').val();
		var title = $('#title').val();
		if(tel.title >10){
			alert('标题不要超过10个字');
			return false;
		}


		if(tel.length >40){
			alert('简介不要超过40个字');
			return false;
		}
	});
	window.onload=function release(){
		var text=document.getElementById('jianjie');
		if(text.value.length>40)
		{
			alert('超过字数')
		}

	}
	function ss(){
		var text = document.getElementById('jianjie');
		var show = document.getElementById('show');


		if(show.innerHTML < 1){
			var date = $('#jianjie').val();

			var value = date.substring(0,40);

			$('#jianjie').val(value);
		}
		show.innerHTML =40 - text.value.length;


	}
	function ee(){
		var text = document.getElementById('title');
		var show = document.getElementById('show1');


		if(show.innerHTML < 1){
			var date = $('#title').val();

			var value = date.substring(0,10);

			$('#title').val(value);
		}
		show.innerHTML =10 - text.value.length;


	}


</script>
